/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package at.punkt.sentimentanalysis.web.json;

import java.util.Map;
import org.springframework.web.servlet.view.json.MappingJacksonJsonView;

/**
 *
 * @author lejtovicz
 */
public class CustomMappingJsonView extends MappingJacksonJsonView {

    @Override
    protected Object filterModel(Map<String, Object> model) {
        Object obj = super.filterModel(model);
        if (obj instanceof Map) {
            Map<String, Object> map = (Map<String, Object>) obj;
            if (!map.isEmpty()) {
                return map.values().iterator().next();
            }
        }
        return obj;
    }
}
